home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d6 / glazer.arc / PERRATE.BAS < prev    next >
BASIC Source File  |  1988-10-07  |  2KB  |  50 lines

  1. 100 'Periodic Rate ("PERRATE")
  2. 110 CLS
  3. 120 COLOR 0,15 : PRINT "Periodic Rate" : COLOR 15,0
  4. 130 DEFSNG A-Z
  5. 140 DEFINT M-N
  6. 150 '     Define function to convert periodic rate to annual rate
  7. 160 DEF FNA (V) = ( (1 + V) ^ NPY - 1) * 100
  8. 170 PCTFMT$ = "###.##_%"
  9. 180 '     Let user enter data
  10. 190 PRINT : PRINT "Do not enter dollar signs or commas"
  11. 200 PRINT
  12. 210 INPUT "Savings goal: ", FV
  13. 220 INPUT "Deposit each period: ", DEPOSIT
  14. 230 INPUT "Term in years: ", NYEARS
  15. 240 INPUT "Number of deposits per year: ", NPY
  16. 250 INPUT "Annual inflation rate (in percent): ", INFLATION
  17. 260 INPUT "Marginal tax rate (in percent): ", TAXRATE
  18. 270 '    Find interest rate for nominal goal
  19. 280 RLOWER = 0    'Initial values
  20. 290 RUPPER = .5
  21. 300 WHILE (RUPPER - RLOWER) > .00001
  22. 310   PR = (RLOWER + RUPPER) / 2
  23. 320   'Calculate payment for trial value
  24. 330   TRIALDEP = FV / ( (1 + PR) * ( (1 + PR) ^ (NPY * NYEARS) - 1) / PR)
  25. 340   IF TRIALDEP < DEPOSIT  THEN RUPPER = PR  ELSE RLOWER = PR
  26. 350 WEND
  27. 360 PR = (RUPPER + RLOWER) / 2         'Convert to annual, taxable rate
  28. 370 AR = FNA (PR)
  29. 380 RTAXABLE = FNA (PR / (1 - TAXRATE / 100) )
  30. 390 '     Interest rate for inflated goal
  31. 400 RLOWER = 0    'Initial values
  32. 410 RUPPER = .5
  33. 420 INFLATION = (1 + INFLATION / 100) ^ (1 / NPY) - 1
  34. 430 FVADJUSTED = FV * (1 + INFLATION) ^ (NPY * NYEARS)
  35. 440 WHILE (RUPPER - RLOWER) > .00001
  36. 450   PR = (RLOWER + RUPPER) / 2
  37. 460   'Calculate payment for trial value
  38. 470   TRIALDEP = FVADJUSTED / ((1 + PR) * ((1 + PR) ^ (NPY * NYEARS) - 1) / PR)
  39. 480   IF TRIALDEP < DEPOSIT  THEN RUPPER = PR  ELSE RLOWER = PR
  40. 490 WEND
  41. 500 RADJTAX = (RUPPER + RLOWER) / 2    'Convert to annual, taxable rate
  42. 510 RADJTAX = FNA(PR / (1 - TAXRATE / 100))
  43. 520 '     Print results
  44. 530 PRINT:PRINT
  45. 540 PRINT "Tax-free interest rate:"; TAB(41); USING PCTFMT$; AR
  46. 550 PRINT "Taxable interest rate:"; TAB(41); USING PCTFMT$; RTAXABLE
  47. 560 PRINT "Taxable interest rate for inflated goal:"; TAB(41);
  48. 570 PRINT USING PCTFMT$; RADJTAX
  49. 580 END
  50.